/**
 * CopyRight © 2012 USTC SINOVATE SOFTWARE CO.LTD All Rights Reserved.
 */

package com.cmcc.zysoft.infocollection.dao;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.cmcc.zysoft.infocollection.model.Message;
import com.starit.common.dao.hibernate.HibernateBaseDaoImpl;

/**
 * @author 袁凤建
 * <br />邮箱: yuan.fengjian@ustcinfo.com
 * <br />描述: MessagePcDao.java
 * <br />版本: 1.0.0
 * <br />日期: 2013-8-30 下午1:10:27
 * <br />CopyRight © 2012 USTC SINOVATE SOFTWARE CO.LTD All Rights Reserved.
 */

@Repository
public class MessagePcDao extends HibernateBaseDaoImpl<Message, String> {

	@Autowired
	private JdbcTemplate jdbcTemplate;
	
	/**
	 * 根据资源ID获取资源审核记录.
	 * @param resourceId 资源ID
	 * @return List<Map<String, Object>>
	 */
	public List<Map<String, Object>> getMessageList(String resourceId) {
		String sql = 
				" SELECT a.*, b.real_name AS addMan " +
				" FROM tb_b_message a, tb_c_system_user b " +
				" WHERE a.add_man = b.user_id AND a.message_key = ? " +
				" ORDER BY a.add_date ASC ";
		return this.jdbcTemplate.queryForList(sql, resourceId);				
	}
}